/**
 * 获取无为数据
 */
import { reactive } from 'vue';
import { getWuwei } from './serverInterface';

export interface WujiInfo{
  /* key */
  id: number;
  /* 作品大图 */
  work: string;
  /* 作品小图 */
  workMin: string;
  /* 愿望 */
  wish: string;
  /* 姓名  */
  name: string;
  /* 年龄 */
  age: number;
  /* 地址 */
  address: string;
  /* 地球小提示*/
  tips: string;
}
const wuwei = reactive<{
  [key: string]: WujiInfo
}>({});
export const wuweiPromise = new Promise<{
  [key: string]: WujiInfo
}>((resolve) => {
  getWuwei({
    schemaid: 'earthDay_2022_workAuthorInfo',
  }).then((data: WujiInfo[]) => {
    data.forEach((info) => {
      wuwei[info.id] = info;
    });
    resolve(wuwei);
  });
});
export default wuwei;
